import type { App } from 'vue'
const modules: Record<string, any> = import.meta.glob('./*.ts', { eager: true })

export function initDirective(app: App) {
  Object.entries(modules).map(([path, module]) => {
    const name = path.replace(/.*?v-([\w]*).*/, '$1')
    const key = `v_${name}`
    const directiveHooks = module[key]()
    app.directive(name, directiveHooks)
  })
}
export default initDirective
